package com.gwq.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.gwq.base.AutoEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.annotation.Validated;

import java.io.Serializable;
import java.util.Objects;

@Data
@TableName("cm_equation")
@AllArgsConstructor
@NoArgsConstructor
@Validated
public class Equation extends AutoEntity<Equation> {

    @ApiModelProperty("左数字")
    private Integer leftOperand;

    @ApiModelProperty("右数字")
    private Integer rightOperand;

    @ApiModelProperty("符号")
    private String operator;

    @ApiModelProperty("结果")
    private Integer sum;

    @ApiModelProperty("题集id")
    private String exercisesId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Equation equation = (Equation) o;
        return (leftOperand.equals(equation.leftOperand) &&rightOperand.equals(equation.rightOperand))||
                (leftOperand.equals(equation.rightOperand) &&rightOperand.equals(equation.leftOperand));
    }

    @Override
    public int hashCode() {
        return Objects.hash(leftOperand, rightOperand);
    }
}
